import React, { Component } from 'react';
import {banner} from "../uilt/api"
import {Swiper} from 'antd-mobile'
class Banner extends Component {
    constructor(props){
        super(props);
        this.state={
            bannerlist:[]
        }
    }
    componentDidMount(){
      banner().then((res)=>{
        this.setState({
         bannerlist:res.data.list
        })
      })
    }
    render() {
        return (
            <div className='banner'>
                   <Swiper autoplay loop>
                   {
                    this.state.bannerlist.length>0&&this.state.bannerlist.map((item,index)=>{
                        return (
                            <Swiper.Item key={index}>
                    <img  src={item.pic} alt=""/>
                 </Swiper.Item>
                        )
                    })
                   }
               </Swiper> 
            </div>
        );
    }
}

export default Banner;